<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
	<head>
		<?php echo $this->Html->charset(); ?>
		<title><?php echo $title_for_layout; ?></title>
		<?php
			echo $this->Html->css('normalize');
			echo $this->Html->css('cinema');
			echo $this->Html->css('bootstrap');
		?>
	</head>
	<body>
		<header>
			<div id="header-content">
				<ul>
					<li>
						<?php
						echo $this->Html->link('à l\'affiche', array(
							'admin' => false,
							'controller' => 'films',
							'action' => 'index'
						));
						?>
					</li>
					<?php if($this->Session->read('Auth.User')) : ?>
					<li>
						Mes séances
					</li>
					<?php endif; ?>
					<?php if($this->Session->read('Auth.User') && $this->Session->read('Auth.User.role') === 'admin') : ?>
					<li>
						<?php
						echo $this->Html->link('admin', array(
							'admin' => true,
							'controller' => 'films',
							'action' => 'index'
						));
						?>
					</li>
					<?php endif; ?>
				</ul>
				<div id="login">
					<?php
					if($this->Session->read('Auth.User'))
					{
						echo $this->Html->link($this->Session->read('Auth.User.username').' - Déconnexion', array(
							'admin' => false,
							'controller' => 'users',
							'action' => 'logout'
						), array(
							'class' => 'logout'
						));
					}
					else
					{
						echo $this->Form->create('User', array('url' => array('controller' => 'users', 'action' => 'login'), 'class' => 'form-inline'));
						echo $this->Form->input('username', array('label' => false, 'placeholder' => 'Identifiant'));
						echo $this->Form->input('password', array('label' => false, 'placeholder' => 'Mot de passe'));
						echo $this->Form->submit('Connexion', array('class' => 'btn btn-small'));
						echo $this->Form->end();
					}
					?>
				</div>
			</div>
		</header>
		<div id="wrapper">
			<?php
			echo $this->Session->flash('auth');
			echo $this->Session->flash();
			echo $this->fetch('content');
			?>
		</div>
		
		<?php
		echo $this->Html->script('jquery-1.8.3.min');
		echo $this->Html->script('plugins');
		echo $this->Html->script('script');
		?>
	</body>
</html>